package xiaoqi.springboot.boot.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import xiaoqi.springboot.boot.dataobject.UserDO;

@Repository
public class UserDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public UserDO selectById(Integer id) {
        return jdbcTemplate.queryForObject("SELECT id, username, password FROM t_user WHERE id = ?", new BeanPropertyRowMapper<>(UserDO.class), id);
    }
}
